home *** CD-ROM | disk | FTP | other *** search
- ' a very simple web service that exposes two methods
-
- Imports System.Web.Services
-
- <WebService(Description:="A web service for converting currencies", _
- Namespace:="http://www.vb2themax.com/")> _
- Public Class Converter
- Inherits System.Web.Services.WebService
-
- #Region " Web Services Designer Generated Code "
-
- Public Sub New()
- MyBase.New()
-
- 'This call is required by the Web Services Designer.
- InitializeComponent()
-
- 'Add your own initialization code after the InitializeComponent() call
-
- End Sub
-
- 'Required by the Web Services Designer
- Private components As System.ComponentModel.IContainer
-
- 'NOTE: The following procedure is required by the Web Services Designer
- 'It can be modified using the Web Services Designer.
- 'Do not modify it using the code editor.
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- components = New System.ComponentModel.Container()
- End Sub
-
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- 'CODEGEN: This procedure is required by the Web Services Designer
- 'Do not modify it using the code editor.
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
-
- #End Region
-
- <WebMethod(Description:="Convert from Euro to Dollar currency")> _
- Function EuroToDollar(ByVal amount As Decimal) As Decimal
- Return amount * GetEuroToDollarConversionRate()
- End Function
-
- <WebMethod(Description:="Convert from Dollar to Euro currency")> _
- Function DollarToEuro(ByVal amount As Decimal) As Decimal
- Return amount / GetEuroToDollarConversionRate()
- End Function
-
- Private Function GetEuroToDollarConversionRate() As Decimal
- ' In a real application this code would read a file or a database.
- Return 0.9@
- End Function
-
- End Class
-
-